// zoj1465
// 题意：给定n个点，求将所有点包围，且离每个点距离至少为l的最小边界。
//
// 题解：其实就是凸包外面包一圈距离为l的圈，拐角处会形成圆弧，
//       仔细观察会发现，圆弧其实是绕一周的，所以就是一个凸包周长半径为l
//       的圆的周长。
//
//
// run: $exec < input
// std: c++98
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>

template <class T>
struct point
{
	typedef T value_type;
	point(value_type x, value_type y) : x(x), y(y) {};
	point() {};
	value_type x, y;
};

typedef int cord_type;
std::vector<point<cord_type> > points;
std::vector<point<cord_type> > stack;

template <class T>
int signum(T const & x)
{
	return (x < 0 ? -1 : x > 0 ? + 1 : 0);
}


template <class T>
T ccw(point<T> const & a, point<T> const & b, point<T> const & c)
{
	return signum((long long)(b.x - a.x) * (c.y - a.y) - (long long)(b.y - a.y) * (c.x - a.x));
}

template <class T>
struct cmp
{
	bool operator()(point<T> const & a, point<T> const & b)
	{
		return a.y < b.y || (a.y == b.y && a.x < b.x);
	}
};

template <class T>
double get_dis(point<T> const & a, point<T> const & b)
{
	return std::sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

const int BZ = 30 << 15;
char Buf[BZ + 1], *buf = Buf;

template <class T>
inline void scan(T &a) // method: for huge input
{
	bool flag = false;
	for (a = 0; *buf < '0' || *buf > '9'; ++buf)
		if (*buf == '-') flag = true;
	for (; *buf >= '0' && *buf <= '9'; buf++)
		a = a * 10 + (*buf - '0');
	if (flag) a = -a;
}

double const pi = acos(-1);

int main()
{
	std::fread(Buf, 1, BZ, stdin);
	int T; scan(T);
	for (int ti = 1; ti <= T; ti++) {
		int n, l; scan(n); scan(l);
		points.resize(n); stack.resize(n + 1);
		for (int i = 0; i < n; i++) { scan(points[i].x); scan(points[i].y); }
		std::sort(points.begin(), points.end(), cmp<cord_type>());

		int top = 0;
		for (int i = 0; i < n; i++) {
			while (top >= 2 && ccw(stack[top - 2], stack[top - 1], points[i]) < 0)
				top--;
			stack[top++] = points[i];
		}
		int t = top + 1;
		for (int i = n - 2; i >= 0; i--) {
			while (top >= t && ccw(stack[top - 2], stack[top - 1], points[i]) < 0)
				top--;
			stack[top++] = points[i];
		}

		// the perimeter of the convex hull
		double ans = 2*pi*l;
		for (int i = 0; i < top - 1; i++)
			ans += get_dis(stack[i], stack[i + 1]);
		std::printf("%d\n", (int)round(ans));
		if (ti < T) std::printf("\n");
	}
}

